<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "activity_donate".
 *
 * @property int $id
 * @property int $good_id 商品id
 * @property int $donate_type 达标类型(1:金额 2:数量)
 * @property int $donate_good_id 赠送商品id
 * @property int $donate_num 赠送数量
 * @property int $status 状态
 * @property int $created_at 创建时间
 */
class ActivityDonate extends Base
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'activity_donate';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['good_id', 'donate_type', 'donate_good_id', 'donate_num', 'status', 'created_at'], 'integer']
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'good_id' => 'Good ID',
            'donate_type' => 'Donate Type',
            'donate_good_id' => 'Donate Good ID',
            'donate_num' => 'Donate Num',
            'status' => 'Status',
            'created_at' => 'Created At',
        ];
    }

    public function getGood(){
        return $this->hasOne(Good::class, ['id' => 'good_id']);
    }
}
